﻿using System.Diagnostics;
using TSharp.Core.Util;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using TSharp.Core.TestUtil;
using FluentAssertions;
using System.Linq;
using System.Linq.Expressions;
using Common.Logging;
using Common.Logging.Simple.Rolling.Configuration;
using Common.Logging.Simple.Rolling.TraceListeners;
using TSharp.Core.Util.Numeric;
using System.Web;
using RazorEngine;
namespace Wicresot.CoreTests
{


    /// <summary>
    ///这是 SafeConvertTest 的测试类，旨在
    ///包含所有 SafeConvertTest 单元测试
    ///</summary>
    [TestClass()]
    public class SafeConvertTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试特性
        // 
        //编写测试时，还可使用以下特性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        [ClassInitialize()]
        public static void MyClassInitialize(TestContext testContext)
        {
            TestHelper.SetupTest();
        }
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        [TestMethod()]
        public void ToBooleanTest()
        {
            //  LogManager.GetCurrentClassLogger().Warn("tttttttttttt");
            SafeConvert.ToBoolean("1", false).Should().Be(true);
            new Action(() => SafeConvert.ToBoolean(new byte[0])).ShouldThrow<Exception>();
            SafeConvert.ToBoolean("真").Should().BeTrue();
            SafeConvert.ToBoolean("1").Should().BeTrue();
            object v = 1;
            SafeConvert.ToBoolean(v).Should().BeTrue();
            v = 1f;
            SafeConvert.ToBoolean(v).Should().BeTrue();
        }

        /// <summary>
        ///ToByte 的测试
        ///</summary>
        [TestMethod()]
        public void ToByteTest()
        {
            var bs1 = new byte[] { Convert.ToByte(0x05), Convert.ToByte(0xca) };
            var bs = HexCodec.GetBytes("05CA");
            var bs2 = Convert.FromBase64String("05CA");
            Console.WriteLine(bs2);
            foreach (var e in System.Text.Encoding.GetEncodings())
            {
                var s1 = e.GetEncoding().GetString(bs1);
                var s = e.GetEncoding().GetString(bs);
                Console.WriteLine(s1 + "\t>> " + e.Name);
                Console.WriteLine(s + "\t>> " + e.Name);
            }

        }



        [TestMethod()]
        public void ToByteTest1()
        {
            SafeConvert.ToByte("3", 0).Should().Be(3); ;
        }



        [TestMethod()]
        public void ToByteTest2()
        {
            SafeConvert.ToByte((object)3).Should().Be(3);
        }

        /// <summary>
        ///ToChar 的测试
        ///</summary>
        [TestMethod()]
        public void ToCharTest()
        {
            string[] array = new string[]{
                "a"
                ,"b"
                ,"c"
            };
        }

        /// <summary>
        ///ToChar 的测试
        ///</summary>
        public void ToCharTest1Helper<T>()
            where T : class
        {
            T obj = null;
            char expected = '\0';
            char actual;
            actual = SafeConvert.ToChar<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToCharTest1()
        {
            ToCharTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToChar 的测试
        ///</summary>
        public void ToCharTest2Helper<T>()
            where T : class
        {
            T obj = null;
            char defaultValue = '\0';
            char expected = '\0';
            char actual;
            actual = SafeConvert.ToChar<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToCharTest2()
        {
            ToCharTest2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDateTime 的测试
        ///</summary>
        [TestMethod()]
        public void ToDateTimeTest()
        {
            long ticks = 0;
            DateTime expected = new DateTime();
            DateTime actual;
            actual = SafeConvert.ToDateTime(ticks);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToDateTime 的测试
        ///</summary>
        public void ToDateTimeTest1Helper<T>()
            where T : class
        {
            T obj = null;
            DateTime expected = new DateTime();
            DateTime actual;
            actual = SafeConvert.ToDateTime<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToDateTimeTest1()
        {
            ToDateTimeTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDateTime 的测试
        ///</summary>
        [TestMethod()]
        public void ToDateTimeTest2()
        {
            string[] array = null;
            DateTime[] expected = null;
            DateTime[] actual;
            actual = SafeConvert.ToDateTimeArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToDateTime 的测试
        ///</summary>
        public void ToDateTimeTest3Helper<T>()
            where T : class
        {
            T obj = null;
            DateTime defaultValue = new DateTime();
            DateTime expected = new DateTime();
            DateTime actual;
            actual = SafeConvert.ToDateTime<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToDateTimeTest3()
        {
            ToDateTimeTest3Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDecimal 的测试
        ///</summary>
        [TestMethod()]
        public void ToDecimalTest()
        {
            string[] array = null;
            Decimal[] expected = null;
            Decimal[] actual;
            actual = SafeConvert.ToDecimalArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToDecimal 的测试
        ///</summary>
        public void ToDecimalTest1Helper<T>()
            where T : class
        {
            T obj = null;
            Decimal expected = new Decimal();
            Decimal actual;
            actual = SafeConvert.ToDecimal<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToDecimalTest1()
        {
            ToDecimalTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDecimal 的测试
        ///</summary>
        public void ToDecimalTest2Helper<T>()
            where T : class
        {
            T obj = null;
            Decimal defaultValue = new Decimal();
            Decimal expected = new Decimal();
            Decimal actual;
            actual = SafeConvert.ToDecimal<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToDecimalTest2()
        {
            ToDecimalTest2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDouble 的测试
        ///</summary>
        public void ToDoubleTestHelper<T>()
            where T : class
        {
            T obj = null;
            double defaultValue = 0F;
            double expected = 0F;
            double actual;
            actual = SafeConvert.ToDouble<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToDoubleTest()
        {
            ToDoubleTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDouble 的测试
        ///</summary>
        public void ToDoubleTest1Helper<T>()
            where T : class
        {
            T obj = null;
            double expected = 0F;
            double actual;
            actual = SafeConvert.ToDouble<T>(obj);
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToDoubleTest1()
        {
            ToDoubleTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToDouble 的测试
        ///</summary>
        [TestMethod()]
        public void ToDoubleTest2()
        {
            string[] array = new string[]{"1","2","3"
            };
            double[] expected = new double[] { 1, 2, 3 };
            double[] actual;
            actual = SafeConvert.ToDoubleArray(array);
            Assert.IsTrue(expected.Select((x, i) => x == actual[i]).Count() == expected.Length);

        }

        /// <summary>
        ///ToEnum 的测试
        ///</summary>
        public void ToEnumTestHelper<T>()
            where T : struct
        {
            string[] array = null;
            T[] expected = null;
            T[] actual;
            actual = SafeConvert.ToEnumArray<T>(array);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToEnumTest()
        {
            Assert.Inconclusive("没有找到能够满足 T 的类型约束的相应类型参数。请以适当的类型参数来调用 ToEnumTestHelper<T>()。");
        }

        /// <summary>
        ///ToEnum 的测试
        ///</summary>
        public void ToEnumTest1Helper<TEnum>()
            where TEnum : struct
        {
            int intvalue = 0;
            TEnum expected = new TEnum();
            TEnum actual;
            actual = SafeConvert.ToEnum<TEnum>(intvalue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToEnumTest1()
        {
            Assert.Inconclusive("没有找到能够满足 TEnum 的类型约束的相应类型参数。请以适当的类型参数来调用 ToEnumTest1Helper<TEnum>()。");
        }

        /// <summary>
        ///ToEnum 的测试
        ///</summary>
        public void ToEnumTest2Helper<T, TEnum>()
            where T : class
            where TEnum : struct
        {
            T obj = null;
            TEnum defaultValue = new TEnum();
            TEnum expected = new TEnum();
            TEnum actual;
            actual = SafeConvert.ToEnum<T, TEnum>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToEnumTest2()
        {
            Assert.Inconclusive("没有找到能够满足 TEnum 的类型约束的相应类型参数。请以适当的类型参数来调用 ToEnumTest2Helper<T, TEnum>()。");
        }

        public enum TestA
        {
            a,
            b,
            c,
            d
        }

        [TestMethod()]
        public void ToEnumTest3()
        {

            SafeConvert.ToEnum<object, TestA>((object)TestA.a)
                .Should().Be(TestA.a);
        }


        [TestMethod()]
        public void ToEnumTest4()
        {
            SafeConvert.ToEnum<TestA>(0L).Should().Be(TestA.a);
        }

        /// <summary>
        ///ToFormatString 的测试
        ///</summary>
        [TestMethod()]
        public void ToFormatStringTest()
        {
            TimeSpan ts = new TimeSpan();
            string expected = "刚刚";
            string actual;
            actual = SafeConvert.ToFormatString(ts);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToGuid 的测试
        ///</summary>
        public void ToGuidTestHelper<T>()
            where T : class
        {
            T obj = null;
            Guid expected = new Guid();
            Guid actual;
            actual = SafeConvert.ToGuid<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToGuidTest()
        {
            ToGuidTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt16 的测试
        ///</summary>
        public void ToInt16TestHelper<T>()
            where T : class
        {
            T obj = null;
            short defaultValue = 0;
            short expected = 0;
            short actual;
            actual = SafeConvert.ToInt16<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt16Test()
        {
            ToInt16TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt16 的测试
        ///</summary>
        public void ToInt16Test1Helper<T>()
            where T : class
        {
            T obj = null;
            short expected = 0;
            short actual;
            actual = SafeConvert.ToInt16<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt16Test1()
        {
            ToInt16Test1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt16 的测试
        ///</summary>
        [TestMethod()]
        public void ToInt16Test2()
        {
            string[] array = null;
            short[] expected = null;
            short[] actual;
            actual = SafeConvert.ToInt16Array(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToInt32 的测试
        ///</summary>
        public void ToInt32TestHelper<T>()
            where T : class
        {
            T obj = null;
            int defaultValue = 0;
            int expected = 0;
            int actual;
            actual = SafeConvert.ToInt32<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt32Test()
        {
            ToInt32TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt32 的测试
        ///</summary>
        [TestMethod()]
        public void ToInt32Test1()
        {
            string[] array = null;
            int[] expected = null;
            int[] actual;
            actual = SafeConvert.ToInt32Array(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToInt32 的测试
        ///</summary>
        public void ToInt32Test2Helper<T>()
            where T : class
        {
            T obj = null;
            int expected = 0;
            int actual;
            actual = SafeConvert.ToInt32<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt32Test2()
        {
            ToInt32Test2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt64 的测试
        ///</summary>
        [TestMethod()]
        public void ToInt64Test()
        {
            string[] array = null;
            long[] expected = null;
            long[] actual;
            actual = SafeConvert.ToInt64Array(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToInt64 的测试
        ///</summary>
        public void ToInt64Test1Helper<T>()
            where T : class
        {
            T obj = null;
            long defaultValue = 0;
            long expected = 0;
            long actual;
            actual = SafeConvert.ToInt64<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt64Test1()
        {
            ToInt64Test1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToInt64 的测试
        ///</summary>
        public void ToInt64Test2Helper<T>()
            where T : class
        {
            T obj = null;
            long expected = 0;
            long actual;
            actual = SafeConvert.ToInt64<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToInt64Test2()
        {
            ToInt64Test2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToNullableDateTime 的测试
        ///</summary>
        public void ToNullableDateTimeTestHelper<T>()
            where T : class
        {
            T obj = null;
            Nullable<DateTime> expected = new Nullable<DateTime>();
            Nullable<DateTime> actual;
            actual = SafeConvert.ToNullableDateTime<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToNullableDateTimeTest()
        {
            ToNullableDateTimeTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToNullableDateTime 的测试
        ///</summary>
        public void ToNullableDateTimeTest1Helper<T>()
            where T : class
        {
            T obj = null;
            Nullable<DateTime> expected = new Nullable<DateTime>();
            Nullable<DateTime> actual;
            actual = SafeConvert.ToNullableDateTime<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToNullableDateTimeTest1()
        {
            ToNullableDateTimeTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToNullableGuid 的测试
        ///</summary>
        public void ToNullableGuidTestHelper<T>()
            where T : class
        {
            T obj = null;
            Nullable<Guid> expected = new Nullable<Guid>();
            Nullable<Guid> actual;
            actual = SafeConvert.ToNullableGuid<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToNullableGuidTest()
        {
            ToNullableGuidTestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToNullableInt32 的测试
        ///</summary>
        public void ToNullableInt32TestHelper<T>()
            where T : class
        {
            T obj = null;
            Nullable<int> expected = new Nullable<int>();
            Nullable<int> actual;
            actual = SafeConvert.ToNullableInt32<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToNullableInt32Test()
        {
            ToNullableInt32TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToSByte 的测试
        ///</summary>
        [TestMethod()]
        public void ToSByteTest()
        {
            string[] array = null;
            sbyte[] expected = null;
            sbyte[] actual;
            actual = SafeConvert.ToSByteArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToSByte 的测试
        ///</summary>
        public void ToSByteTest1Helper<T>()
            where T : class
        {
            T obj = null;
            sbyte defaultValue = 0;
            sbyte expected = 0;
            sbyte actual;
            actual = SafeConvert.ToSByte<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToSByteTest1()
        {
            ToSByteTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToSByte 的测试
        ///</summary>
        public void ToSByteTest2Helper<T>()
            where T : class
        {
            T obj = null;
            sbyte expected = 0;
            sbyte actual;
            actual = SafeConvert.ToSByte<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToSByteTest2()
        {
            ToSByteTest2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToSingle 的测试
        ///</summary>
        [TestMethod()]
        public void ToSingleTest()
        {
            string[] array = null;
            float[] expected = null;
            float[] actual;
            actual = SafeConvert.ToSingleArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToSingle 的测试
        ///</summary>
        public void ToSingleTest1Helper<T>()
            where T : class
        {
            T obj = null;
            float defaultValue = 0F;
            float expected = 0F;
            float actual;
            actual = SafeConvert.ToSingle<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToSingleTest1()
        {
            ToSingleTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToSingle 的测试
        ///</summary>
        public void ToSingleTest2Helper<T>()
            where T : class
        {
            T obj = null;
            float expected = 0F;
            float actual;
            actual = SafeConvert.ToSingle<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToSingleTest2()
        {
            ToSingleTest2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToString 的测试
        ///</summary>
        [TestMethod()]
        public void ToStringTest()
        {
            object[] array = null;
            string[] expected = null;
            string[] actual;
            actual = SafeConvert.ToStringArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToStringObject 的测试
        ///</summary>
        [TestMethod()]
        public void ToStringObjectTest()
        {
            object @object = null;
            string defaultValue = string.Empty;
            string expected = string.Empty;
            string actual;
            actual = SafeConvert.ToStringObject(@object, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToStringObject 的测试
        ///</summary>
        [TestMethod()]
        public void ToStringObjectTest1()
        {
            object @object = null;
            string expected = null;
            string actual;
            actual = SafeConvert.ToStringObject(@object);
            Assert.AreEqual(expected, actual);
            @object = "abcde";
            expected = "abcde";

            actual = SafeConvert.ToStringObject(@object);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///ToTimeSpan 的测试
        ///</summary>
        [TestMethod()]
        public void ToTimeSpanTest()
        {
            string[] array = null;
            TimeSpan[] expected = null;
            TimeSpan[] actual;
            actual = SafeConvert.ToTimeSpanArray(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToTimeSpan 的测试
        ///</summary>
        public void ToTimeSpanTest1Helper<T>()
            where T : class
        {
            T obj = null;
            TimeSpan defaultValue = new TimeSpan();
            TimeSpan expected = new TimeSpan();
            TimeSpan actual;
            actual = SafeConvert.ToTimeSpan<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToTimeSpanTest1()
        {
            ToTimeSpanTest1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToTimeSpan 的测试
        ///</summary>
        public void ToTimeSpanTest2Helper<T>()
            where T : class
        {
            T obj = null;
            TimeSpan expected = new TimeSpan();
            TimeSpan actual;
            actual = SafeConvert.ToTimeSpan<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToTimeSpanTest2()
        {
            ToTimeSpanTest2Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToTimeSpanStringFromNow 的测试
        ///</summary>
        [TestMethod()]
        public void ToTimeSpanStringFromNowTest()
        {
            DateTime dt = new DateTime(2012, 1, 1);
            string expected = "1年";
            string actual;
            actual = SafeConvert.ToTimeSpanStringFromNow(dt);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToUInt16 的测试
        ///</summary>
        public void ToUInt16TestHelper<T>()
            where T : class
        {
            T obj = null;
            ushort defaultValue = 0;
            ushort expected = 0;
            ushort actual;
            actual = SafeConvert.ToUInt16<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt16Test()
        {
            ToUInt16TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt16 的测试
        ///</summary>
        public void ToUInt16Test1Helper<T>()
            where T : class
        {
            T obj = null;
            ushort expected = 0;
            ushort actual;
            actual = SafeConvert.ToUInt16<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt16Test1()
        {
            ToUInt16Test1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt16 的测试
        ///</summary>
        [TestMethod()]
        public void ToUInt16Test2()
        {
            string[] array = null;
            ushort[] expected = null;
            ushort[] actual;
            actual = SafeConvert.ToUInt16Array(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToUInt32 的测试
        ///</summary>
        public void ToUInt32TestHelper<T>()
            where T : class
        {
            T obj = null;
            uint expected = 0;
            uint actual;
            actual = SafeConvert.ToUInt32<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt32Test()
        {
            ToUInt32TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt32 的测试
        ///</summary>
        public void ToUInt32Test1Helper<T>()
            where T : class
        {
            T obj = null;
            uint defaultValue = 0;
            uint expected = 0;
            uint actual;
            actual = SafeConvert.ToUInt32<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt32Test1()
        {
            ToUInt32Test1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt32 的测试
        ///</summary>
        [TestMethod()]
        public void ToUInt32Test2()
        {
            string[] array = null;
            uint[] expected = null;
            uint[] actual;
            actual = SafeConvert.ToUInt32Array(array);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ToUInt64 的测试
        ///</summary>
        public void ToUInt64TestHelper<T>()
            where T : class
        {
            T obj = null;
            ulong expected = 0;
            ulong actual;
            actual = SafeConvert.ToUInt64<T>(obj);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt64Test()
        {
            ToUInt64TestHelper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt64 的测试
        ///</summary>
        public void ToUInt64Test1Helper<T>()
            where T : class
        {
            T obj = null;
            ulong defaultValue = 0;
            ulong expected = 0;
            ulong actual;
            actual = SafeConvert.ToUInt64<T>(obj, defaultValue);
            Assert.AreEqual(expected, actual);

        }

        [TestMethod()]
        public void ToUInt64Test1()
        {
            ToUInt64Test1Helper<GenericParameterHelper>();
        }

        /// <summary>
        ///ToUInt64 的测试
        ///</summary>
        [TestMethod()]
        public void ToUInt64Test2()
        {
            string[] array = null;
            ulong[] expected = null;
            ulong[] actual;
            actual = SafeConvert.ToUInt64Array(array);
            Assert.AreEqual(expected, actual);

        }


        [TestMethod()]
        public void ChangeTypeTest()
        {

            object v = "33333"; // TODO: 初始化为适当的值
            object expected = 33333; // TODO: 初始化为适当的值
            int actual;
            actual = SafeConvert.ChangeType<int>(v);
            Assert.AreEqual(expected, actual);

        }

        /// <summary>
        ///ChangeType 的测试
        ///</summary>
        [TestMethod()]
        public void ChangeTypeTest1()
        {
            //  ILog log = LogManager.GetCurrentClassLogger();
            Type t = typeof(int); // TODO: 初始化为适当的值
            object v = "33333"; // TODO: 初始化为适当的值
            object expected = 33333; // TODO: 初始化为适当的值
            object actual;
            actual = SafeConvert.ChangeType(v, t);
            Assert.AreEqual(expected, actual);
        }
    }
}
